﻿@*总的错误提示*@
<div class="alert alert-danger display-hide">
    <button class="close" data-close="alert"></button>
    You have some form errors. Please check below.
</div>
<div class="alert alert-success display-hide">
    <button class="close" data-close="alert"></button>
    Your form validation is successful!
</div>

@*如果錯誤信息不為空返回錯誤信息，与后台的BaseController.AddError()方法相互呼应*@
@{ var error = Html.ValidationSummary(); }
@if (ViewBag.HasModelError != null && ViewBag.HasModelError)
{
    <div class="alert alert-danger id=errorSummary">
        <button class="close" data-close="alert"></button>
        @error
    </div>
    @section ModelStateScript{
        <script>
            //滚动到错误显示的地方
            $(function () {
                var errorSummary = $('#errorSummary');
                App.scrollTo(errorSummary, -200);
            })
        </script>
    }
}

@*提示成功信息*@
@if (ViewBag.SuccessInfo != null && !string.IsNullOrEmpty(ViewBag.SuccessInfo.ToString()))
{
    <div class="alert alert-success">
        <button class="close" data-close="alert"></button>
        @ViewBag.SuccessInfo
    </div>
}

@*执行View中的Js*@
@section ViewScript{
    <script>
        $(function () {
            @ViewBag.ViewScript
        })
    </script>
}
